package com.chaos.framework.model.exception;

import com.chaos.framework.model.dto.result.Result;
import com.chaos.framework.model.enums.ResultEnum;
import lombok.Data;

@Data
public class BusinessException extends RuntimeException {
    private Result result;

    public BusinessException() {
        this.result = Result.of(ResultEnum.INTERNAL_SERVER_ERROR);
    }

    public BusinessException(ResultEnum resultEnum) {
        this.result = Result.of(resultEnum);
    }

    public BusinessException(Integer code, String msg) {
        this.result = Result.of(code, msg);
    }

    public BusinessException(String msg) {
        this.result = Result.of(ResultEnum.INTERNAL_SERVER_ERROR.getCode(), msg);
    }
}
